/// <reference path="./w.d.ts" />
// http://www.w3cschool.cn/typescript/typescript-tsconfig-json.html


function sayHello(person: string) {
  return 'Hello, ' + person;
}

let user = 'Xcat Liu';

document.body.innerHTML = sayHello(user);

var Visualizer = function() {
  this.file = null, //要处理的文件，后面会讲解如何获取文件
      this.fileName = null, //要处理的文件的名，文件名
      this.audioContext = null, //进行音频处理的上下文，稍后会进行初始化
      this.source = null//保存音频
};
Visualizer.prototype = {
  _prepareAPI: function() {
    //统一前缀，方便调用
    window.AudioContext = window.AudioContext || window.webkitAudioContext || window.mozAudioContext || window.msAudioContext;
    //这里顺便也将requestAnimationFrame也打个补丁，后面用来写动画要用
    window.requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame;
    //安全地实例化一个AudioContext并赋值到Visualizer的audioContext属性上，方便后面处理音频使用
    try {
      this.audioContext = new AudioContext();
    } catch (e) {
      console.log('!妳的浏览器不支持AudioContext:(');
      console.log(e);
    }
  },
}